@import '../../style/themes/index';
@import '../../style/mixins/index';

@import './token.less';

@form-prefix-cls: ~'@{kd-prefix}-form';
@field-prefix-cls: ~'@{form-prefix-cls}-field';
@field-label-cls: ~'@{field-prefix-cls}-label';
@field-wrapper-cls: ~'@{field-prefix-cls}-wrapper';

.@{form-prefix-cls} {
  .reset-component;

  &-horizontal, &-vertical {
    .@{field-prefix-cls} {
      display: flex;
    }
  }

  &-horizontal {
    .@{field-label-cls} {
      flex-shrink: 0;
    }
  }

  &-inline {
    .@{field-prefix-cls} {
      display: inline-flex;
    }
  }
}

.@{field-prefix-cls} {
  align-items: center;
  margin: 0 @form-field-spacing-margin-right @form-field-spacing-margin-bottom 0 ;

  &-vertical {
    align-items: flex-start;
    flex-direction: column;

    .@{field-label-cls} {
      margin-bottom: @form-field-label-spacing-margin-bottom;
    }
  }

  &-hidden {
    display: none !important;
  }
}

.@{field-label-cls} {
  font-size: @form-field-label-font-size;
  line-height: @form-field-label-line-height;
  color: @form-field-color;
  text-align: left;
  margin-right: 30px;
  &-right {
    text-align: right;
  }

  &-required-mark {
    position: relative;
  }

  &-required-mark::after {
    content: '*';
    position: absolute;
    top: -1px;
    right: -9px;
    width: 5px;
    height: 5px;
    line-height: 1;
    color: @form-error-color;
  }
}

.@{field-wrapper-cls} {
  position: relative;
  &-message {
    position: absolute;
    left: -7px;
    right: 0;
    padding: @form-field-message-spacing-padding-horizontal @form-field-message-spacing-padding-vertical;
    font-size: @form-field-message-font-size;
    line-height: @form-field-message-line-height;
    color: @form-error-color;
    word-break: break-word;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
